{{extend './common/layout.html'}}

{{block 'link'}}
	<link rel="stylesheet" href="/home/css/index.css">
{{/block}}
{{block 'main'}}

{{include './common/header.html'}}
	<!-- 文章列表开始 -->
	<ul class="list w1100">
	{{each result.records}}
		<li class="{{$index %2 == 0 ? 'fl' : 'fr'}}">
			<a href="/home/article?id={{@$value._id}}" class="thumbnail" >
				<img src="{{$value.cover}}">
			</a>
			<div class="content">
				<a class="article-title" href="/home/article?id={{@$value._id}}">{{$value.title}}</a>
				<div class="article-info">
					<span class="author">{{$value.author.username}}</span>
					<span>{{dateFormat($value.publishDate,"yyyy-mm-dd")}}</span>
				</div>
				<div class="brief">
					<!-- 去除html 标签  -->
					{{@$value.content.replace(/<[^>]+>/g,'').substr(0,100) + '...'}}
					
				</div>
				<div class="article-info">
					<span class="author">访问量:{{$value.count}}</span>
				
				</div>
			</div>
		</li>
	{{/each}}	
	</ul>
	<!-- 文章列表结束 -->

	<!-- 分页开始 -->
	<div class="page w1100">
	
		{{if result.page > 1}}
		<a href="/home/?page={{result.page - 1}}">上一页</a>
		{{/if}}

		{{each result.display}}
		<a href="/home/?page={{$value}}" class="{{$value == result.page ? 'active' : ''}}" >{{$value}}</a>
		{{/each}}
		{{if result.page < result.pages}}
		<a href="/home/?page={{result.page - 0 + 1}}">下一页</a>
		{{/if}}
	</div>
	<!-- 分页结束 -->
{{/block}}